Don't do anything if style doesn't change. Improve debugging output.
authorTor Lillqvist <tml@novell.com>
Fri, 23 May 2008 18:25:12 +0000 (18:25 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Fri, 23 May 2008 18:25:12 +0000 (18:25 +0000)
2008-05-23  Tor Lillqvist  <tml@novell.com>

* gdk/win32/gdkwindow-win32.c (update_style_bits): Don't do
anything if style doesn't change. Improve debugging output.

svn path=/trunk/; revision=20129

ChangeLog
gdk/win32/gdkwindow-win32.c

index 11c442e20ad85ce39db76eeca718f01f82306c11..537f4888e43d7547f674cc216d3e78137f0b5f95 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-23  Tor Lillqvist  <tml@novell.com>
+
+       * gdk/win32/gdkwindow-win32.c (update_style_bits): Don't do
+       anything if style doesn't change. Improve debugging output.
+
 2008-05-23  Michael Natterer  <mitch@gimp.org>
 
        * perf/widgets.h
 
 2008-05-20 14:27:34  Tim Janik  <timj@imendio.com>
 
-       * reverted recent unapproved changes by Yair Hershkovitz, regarding:
-       Bug 503071 – Application direction changes to right to left even if theres no translation.
+       * reverted recent unapproved changes by Yair Hershkovitz,
+       regarding: Bug 503071 – Application direction changes to right
+       to left even if theres no translation.
 
 2008-05-19  Richard Hult  <richard@imendio.com>
 
index 19762350bcee68388017c1edb24e20a42b2a02c3..2ead9ee9469823e61e09aa85c90faae9ab8b6ee9 100644 (file)
@@ -2886,35 +2886,44 @@ static void
 update_style_bits (GdkWindow *window)
 {
   GdkWMDecoration decorations;
-  LONG style, exstyle;
+  LONG old_style, new_style, exstyle;
   gboolean all;
   RECT rect, before, after;
 
-  style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
+  old_style = GetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE);
   exstyle = GetWindowLong (GDK_WINDOW_HWND (window), GWL_EXSTYLE);
 
   GetClientRect (GDK_WINDOW_HWND (window), &before);
   after = before;
-  AdjustWindowRectEx (&before, style, FALSE, exstyle);
-
-  GDK_NOTE (MISC, g_print ("update_style_bits: style: %s", _gdk_win32_window_style_to_string (style)));
+  AdjustWindowRectEx (&before, old_style, FALSE, exstyle);
 
+  new_style = old_style;
   if (get_effective_window_decorations (window, &decorations))
     {
       all = (decorations & GDK_DECOR_ALL);
-      update_single_bit (&style, all, decorations & GDK_DECOR_BORDER, WS_BORDER);
-      update_single_bit (&style, all, decorations & GDK_DECOR_RESIZEH, WS_THICKFRAME);
-      update_single_bit (&style, all, decorations & GDK_DECOR_TITLE, WS_CAPTION);
-      update_single_bit (&style, all, decorations & GDK_DECOR_MENU, WS_SYSMENU);
-      update_single_bit (&style, all, decorations & GDK_DECOR_MINIMIZE, WS_MINIMIZEBOX);
-      update_single_bit (&style, all, decorations & GDK_DECOR_MAXIMIZE, WS_MAXIMIZEBOX);
+      update_single_bit (&new_style, all, decorations & GDK_DECOR_BORDER, WS_BORDER);
+      update_single_bit (&new_style, all, decorations & GDK_DECOR_RESIZEH, WS_THICKFRAME);
+      update_single_bit (&new_style, all, decorations & GDK_DECOR_TITLE, WS_CAPTION);
+      update_single_bit (&new_style, all, decorations & GDK_DECOR_MENU, WS_SYSMENU);
+      update_single_bit (&new_style, all, decorations & GDK_DECOR_MINIMIZE, WS_MINIMIZEBOX);
+      update_single_bit (&new_style, all, decorations & GDK_DECOR_MAXIMIZE, WS_MAXIMIZEBOX);
     }
 
-  GDK_NOTE (MISC, g_print (" => %s\n", _gdk_win32_window_style_to_string (style)));
+  if (old_style == new_style)
+    {
+      GDK_NOTE (MISC, g_print ("update_style_bits: %p: no change\n",
+                              GDK_WINDOW_HWND (window)));
+      return;
+    }
+
+  GDK_NOTE (MISC, g_print ("update_style_bits: %p: %s => %s\n",
+                          GDK_WINDOW_HWND (window),
+                          _gdk_win32_window_style_to_string (old_style),
+                          _gdk_win32_window_style_to_string (new_style)));
 
-  SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, style);
+  SetWindowLong (GDK_WINDOW_HWND (window), GWL_STYLE, new_style);
 
-  AdjustWindowRectEx (&after, style, FALSE, exstyle);
+  AdjustWindowRectEx (&after, new_style, FALSE, exstyle);
 
   GetWindowRect (GDK_WINDOW_HWND (window), &rect);
   rect.left += after.left - before.left;